#ifndef QHLVLCPLAYER_H
#define QHLVLCPLAYER_H

#include "vlc/vlc.h"

#include <QObject>

class QHVlcPlayer : public QObject
{
    Q_OBJECT

public:
    explicit QHVlcPlayer(QObject *parent = nullptr);
    ~QHVlcPlayer();

    void setLocalFile(const QString &fileName,void *hwnd);
    void setUrl(const QString &url,void *hwnd);
    int play();
    void pause();
    void stop();
    void setVolume(int value);
    int getVolume();
    int screenshot(const QString &name);
    void setMute(bool value);
    void seekTo(float value);
    bool isOpen();
    bool isPlaying();
    bool isPause();
    long long getTotalTime();
    int getPlayState();
    void release();

private:
    libvlc_instance_t *m_vlcInstance;
    libvlc_media_t *m_media;
    libvlc_media_player_t *m_vlcMediaPlayer;
    libvlc_event_manager_t *m_vlcEventManager;

    QString m_url;

signals:
    void signalPositonChanged(float pos);
    void signalTimeChanged(long long msec);
    void signalMediaPlaying();
    void signalMediaError();
};

#endif // QHLVLCPLAYER_H
